home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / full / jbuild / setup / JBuilder / jruntime.z / TabbedPages.java < prev    next >
Encoding:
Java Source  |  1997-08-11  |  2.1 KB  |  91 lines

  1. // This snippet creates a new tabbed panel
  2. // <File=TabbedPages.java>
  3.  
  4. //Title:
  5. //Version:
  6. //Copyright:
  7. //Author:
  8. //Company:
  9. //Description:
  10.  
  11. //<PACKAGE>
  12.  
  13. import java.awt.*;
  14. import java.awt.event.*;
  15. import borland.jbcl.layout.*;
  16. import borland.jbcl.control.*;
  17.  
  18. public class TabbedPages extends BevelPanel {
  19.   XYLayout xYLayout1 = new XYLayout();
  20.   TabsetPanel tabsetPanel1 = new TabsetPanel();
  21.   Panel panel1 = new Panel();
  22.   Button ok = new Button();
  23.   Button cancel = new Button();
  24.  
  25.   public TabbedPages() {
  26.     try {
  27.       jbInit();
  28.     }
  29.     catch (Exception e) {
  30.       e.printStackTrace();
  31.     }
  32.   }
  33.  
  34.   public void jbInit() throws Exception {
  35.     xYLayout1.setWidth(389);
  36.     xYLayout1.setHeight(228);
  37.     tabsetPanel1.setLabels(new String[] {"TabSheet1", "TabSheet2", "TabSheet3"});
  38.     ok.setLabel("OK");
  39.     ok.addActionListener(new TabbedPages_ok_actionAdapter(this));
  40.     cancel.setLabel("Cancel");
  41.     cancel.addActionListener(new TabbedPages_cancel_actionAdapter(this));
  42.     this.setLayout(xYLayout1);
  43.     this.add(tabsetPanel1, new XYConstraints(10, 5, 367, 178));
  44.     this.add(ok, new XYConstraints(79, 188, 97, 31));
  45.     this.add(cancel, new XYConstraints(192, 188, 97, 31));
  46.   }
  47.  
  48. //<Exclude>
  49.   // Test case
  50.   public static void main(String[] argv) {
  51.     DecoratedFrame frame = new DecoratedFrame();
  52.     TabbedPages tp = new TabbedPages();
  53.     frame.add(tp);
  54.     frame.pack();
  55.     frame.show();
  56.   }
  57.  
  58. //</Exclude>
  59.   void ok_actionPerformed(ActionEvent e) {
  60.     //!ToDo
  61.   }
  62.  
  63.   void cancel_actionPerformed(ActionEvent e) {
  64.     //!ToDo
  65.   }
  66. }
  67.  
  68. class TabbedPages_ok_actionAdapter implements ActionListener {
  69.   TabbedPages adaptee;
  70.  
  71.   TabbedPages_ok_actionAdapter(TabbedPages adaptee) {
  72.     this.adaptee = adaptee;
  73.   }
  74.  
  75.   public void actionPerformed(ActionEvent e) {
  76.     adaptee.ok_actionPerformed(e);
  77.   }
  78. }
  79.  
  80. class TabbedPages_cancel_actionAdapter implements ActionListener {
  81.   TabbedPages adaptee;
  82.  
  83.   TabbedPages_cancel_actionAdapter(TabbedPages adaptee) {
  84.     this.adaptee = adaptee;
  85.   }
  86.  
  87.   public void actionPerformed(ActionEvent e) {
  88.     adaptee.cancel_actionPerformed(e);
  89.   }
  90. }
  91.